package com.chenjun.core.service.oa.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.chenjun.common.bean.Pagination;
import com.chenjun.common.model.DataGridModel;
import com.chenjun.core.dao.generator.entity.OaDictHolidays;
import com.chenjun.core.dao.generator.mapper.OaDictHolidaysMapper;
import com.chenjun.core.service.oa.OaDictHolidaysService;

@Service
@Transactional
public class OaDictHolidaysServiceImpl implements OaDictHolidaysService {

	@Autowired
	private OaDictHolidaysMapper oaDictHolidaysMapper;
	
	@Override
	public OaDictHolidays get(int id) {
		return oaDictHolidaysMapper.selectByPrimaryKey(id);
	}

	@Override
	public int create(OaDictHolidays oaDictHolidays) {
		return oaDictHolidaysMapper.insert(oaDictHolidays);
	}

	@Override
	public int delete(String id) {
		return oaDictHolidaysMapper.deleteByPrimaryKey(Integer.valueOf(id));
	}

	@Override
	public int update(OaDictHolidays oaDictHolidays) {
		return oaDictHolidaysMapper.updateByPrimaryKey(oaDictHolidays);
	}

	@Override
	public List<OaDictHolidays> doListByCondition(DataGridModel param) {
		return oaDictHolidaysMapper.selectByCondition(param);
	}

	@Override
	public Pagination doPagination(DataGridModel param) {
		Pagination vo = new Pagination();
		List<OaDictHolidays> list = oaDictHolidaysMapper.doListByCondition(param);
		param.setStart(0);
		param.setRows(0);
		int size = list.size();
		vo.setAaData(list);
		vo.setiTotalRecords(size);
		vo.setsEcho(param.getPage());
		vo.setiTotalDisplayRecords(size);
		return vo;
	}
	
	

}
